<!DOCTYPE HTML>
<html>
<head>
    <title>安置帮教-年度鉴定</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
</head>
<style>
    .delBtn {
        border:1px solid #ff2120;
        border-radius:10px;
        font-size:8px;
        line-height:20px;
        font-weight:bold;
        color:#ff4634;
    }
    .editBtn {
        border:1px solid #018d00;
        border-radius:10px;
        font-size:8px;
        line-height:20px;
        font-weight:bold;
        color:#00a60a;
    }
</style>
<body>
<div class="mini-fit">
    <#--罪犯编号-->
    <input id="priNum" name="priNum" class="mini-hidden" value="${priNum}" />
    <div style="height:100%;width: 100%;overflow-x: auto;overflow-y: auto;padding: 10px;">
        <div id="editform" class="form" style="padding:10px;">
            <span style="font-size: 15px">${pname!''}&emsp;</span>/<span style="font-size: 15px">${sex!''}</span>
        </div>
        <div id="editform2" class="form" style="padding:10px;">
            <table class="form-table" width="100%">
                <tr style="line-height: 30px;">
                    <td width="40%"><span style="color: #8B8B8B">身份证号:&emsp;</span>${idnum!''}
                    </td>
                    <td width="40%"><span style="color: #8B8B8B">出生日期:&emsp;</span>${age!''}
                    </td>
                </tr>
                <tr style="line-height: 30px;">
                    <td><span style="color: #8B8B8B">户籍地址:&emsp;</span>${hjdz!''}
                    </td>
                    <td><span style="color: #8B8B8B">居住地址:&emsp;</span>${jzdz!''}
                    </td>
                </tr>
            </table>
        </div>
        <div id="editform3" class="form" style="padding:10px;">
            <span style="font-size: 18px">鉴定信息&emsp;&emsp;&emsp;</span> <a class="mini-button  mini-button-primary"
                                                                           onclick="addJdInfoData('${priNum!''}')">新增</a>
        </div>
        <div>
            <div id="datagrid1" class="mini-datagrid" style="width: 100%;" ajaxType="get" alwaysShowEmptyText="true"
                 autoload="true" showEmptyText="true" emptyText="暂无数据" multiSelect="true" showPager="true" sizeList="[5,10,20]" pageSize="5"
                 url="/azbj/azbjgl/azgzgl/view/getJdBaseInfoList?priNum=${priNum!''}" allowCellWrap="true">
                <div property="columns">
                    <div type="indexcolumn" align="center" width="5%" headerAlign="center" width="20%">序列</div>
                    <div name="niandu" field="niandu" width="6%" align="center" headerAlign="center" allowSort="false">年度
                    </div>
                    <div name="zongfen" field="zongfen" width="9%" align="center" headerAlign="center" allowSort="false">评估分数
                    </div>
                    <div name="wxcd" field="wxcd" width="15%" align="center" renderer="onWxcdRenderer" headerAlign="center" allowSort="false">危险程度
                    </div>
                    <div name="jielun" field="jielun" width="15%" align="center" headerAlign="center" allowSort="false">鉴定结果
                    </div>
                    <div name="nextstep" field="nextstep" width="15%" align="center" headerAlign="center" allowSort="false">下一步措施
                    </div>
                    <div name="action" width="20%" align="center" headerAlign="center" renderer="onActionRenderer" allowSort="false">操作
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

<script type="text/javascript">
    mini.parse();
    var ftab = 1;
    var priNumObj = mini.get("priNum");
    var grid = mini.get("datagrid1");
    //渲染列中按钮
    function onActionRenderer(e) {
        var s = '';
        s += '&nbsp;<a class="mini-button mini-button-primary"  onclick="editJdInfoData()"  >&nbsp;&nbsp;编辑&nbsp;&nbsp;</a>&nbsp';
        s += '&nbsp;<a class="mini-button mini-button-danger"   onclick="delJdInfoData()"   >&nbsp;&nbsp;删除&nbsp;&nbsp;</a>&nbsp';
        s += '&nbsp;<a class="mini-button mini-button-info"   onclick="viewJdInfoData()"   >&nbsp;&nbsp;查看&nbsp;&nbsp;</a>&nbsp';
        return s;
    }

    function editJdInfoData() {
        var row = grid.getSelected();
        mini.open({
            targetWindow: window.parent,
            url: "/azbj/azbjgl/azgzgl/view/toEditAppraiseTab?priNum=" + row.priNum + "&id=" + row.id,
            title: "编辑-鉴定信息",
            width: "60%",
            height: "80%",
            allowDrag: true,
            allowResize: false,
            showCloseButton: true,
            onload: function () {
            },
            ondestroy: function (action) {
                grid.reload();
            }
        });
    }

    function viewJdInfoData() {
        var row = grid.getSelected();
        mini.open({
            targetWindow: window.parent,
            url: "/azbj/azbjgl/azgzgl/view/toViewAppraiseTabs?priNum=" + row.priNum + "&id=" + row.id,
            title: "查看-鉴定信息",
            width: "60%",
            height: "80%",
            allowDrag: true,
            allowResize: false,
            showCloseButton: true,
            onload: function () {
            },
            ondestroy: function (action) {
                grid.reload();
            }
        });
    }

    function delJdInfoData(e) {
        var cfStr = "确认删除该条鉴定记录吗？"
        mini.confirm(cfStr, "确定？", function (action) {
            if (action == "ok") {
                var row = grid.getSelected();
                $.ajax({
                    url: "/azbj/azbjgl/azgzgl/toDelAppraise?id=" + row.id + "&priNum=" + row.priNum,
                    type: "post",
                    data: {delId: e},
                    success: function (result) {
                        if (result.code == 1) {
                            mini.alert("删除成功");
                            grid.reload();
                        } else if (result.code == 5599) {
                            mini.alert(result.message);
                        } else {
                            mini.alert("删除失败");
                        }
                    }
                });
            }
        });
    }

    function onWxcdRenderer(e) {
        var fs = e.value;
        var s = "";
        if (fs == "") {
            return "";
        }
        if (fs > 50) {
            s = '<span style="color: red">高危险性人员</span> ';
        } else if (fs > 40 && fs <= 50) {
            s = '<span style="color: #ee623c ">较高危险性人员</span> ';
        } else if (fs > 30 && fs <= 40) {
            s = '<span style="color: #ff5a39 ">一般等级危险性人员</span> ';
        } else {
            s = '<span style="color: #2b7dbc ">低等级危险性人员</span> ';
        }
        return s;
    }

    //添加年度鉴定信息
    function addJdInfoData(PriNum) {
        mini.open({
            url: "/azbj/azbjgl/azgzgl/view/toAddAppraiseTabs?priNum=" + PriNum,
            title: "年度鉴定",
            width: "60%",
            height: "80%",
            allowDrag: true,
            allowResize: false,
            showCloseButton: true,
            onload: function () {
            },
            ondestroy: function (action) {
                grid.reload();
            }
        });
    }
</script>
</body>
</html>